package com.ldg.crm.dao;

import com.ldg.crm.entity.BusinessInfoEntity;
import com.ldg.crm.entity.BusinessInfoEntityExample;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectKey;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;

public interface BusinessInfoDao {
    /**
     *
     * @mbg.generated
     */
    @SelectProvider(type=BusinessInfoEntitySqlProvider.class, method="countByExample")
    long countByExample(BusinessInfoEntityExample example);

    /**
     *
     * @mbg.generated
     */
    @DeleteProvider(type=BusinessInfoEntitySqlProvider.class, method="deleteByExample")
    int deleteByExample(BusinessInfoEntityExample example);

    /**
     *
     * @mbg.generated
     */
    @Delete({
        "delete from crm_business_info",
        "where bus_id = #{busId,jdbcType=INTEGER}"
    })
    int deleteByPrimaryKey(Integer busId);

    /**
     *
     * @mbg.generated
     */
    @Insert({
        "insert into crm_business_info (bus_id, cid, ",
        "uid, name, marketing_mode, ",
        "value, total_amount, ",
        "due_date, practical_date, ",
        "create_date, update_date, ",
        "total_price, comment)",
        "values (#{busId,jdbcType=INTEGER}, #{cid,jdbcType=INTEGER}, ",
        "#{uid,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR}, #{marketingMode,jdbcType=VARCHAR}, ",
        "#{value,jdbcType=INTEGER}, #{totalAmount,jdbcType=INTEGER}, ",
        "#{dueDate,jdbcType=DATE}, #{practicalDate,jdbcType=DATE}, ",
        "#{createDate,jdbcType=DATE}, #{updateDate,jdbcType=DATE}, ",
        "#{totalPrice,jdbcType=DOUBLE}, #{comment,jdbcType=LONGVARCHAR})"
    })
    @SelectKey(statement="SELECT LAST_INSERT_ID()", keyProperty="busId", before=true, resultType=Integer.class)
    int insert(BusinessInfoEntity record);

    /**
     *
     * @mbg.generated
     */
    @InsertProvider(type=BusinessInfoEntitySqlProvider.class, method="insertSelective")
    @SelectKey(statement="SELECT LAST_INSERT_ID()", keyProperty="busId", before=true, resultType=Integer.class)
    int insertSelective(BusinessInfoEntity record);

    /**
     *
     * @mbg.generated
     */
    @SelectProvider(type=BusinessInfoEntitySqlProvider.class, method="selectByExampleWithBLOBs")
    @Results({
        @Result(column="bus_id", property="busId", jdbcType=JdbcType.INTEGER, id=true),
        @Result(column="cid", property="cid", jdbcType=JdbcType.INTEGER),
        @Result(column="uid", property="uid", jdbcType=JdbcType.INTEGER),
        @Result(column="name", property="name", jdbcType=JdbcType.VARCHAR),
        @Result(column="marketing_mode", property="marketingMode", jdbcType=JdbcType.VARCHAR),
        @Result(column="value", property="value", jdbcType=JdbcType.INTEGER),
        @Result(column="total_amount", property="totalAmount", jdbcType=JdbcType.INTEGER),
        @Result(column="due_date", property="dueDate", jdbcType=JdbcType.DATE),
        @Result(column="practical_date", property="practicalDate", jdbcType=JdbcType.DATE),
        @Result(column="create_date", property="createDate", jdbcType=JdbcType.DATE),
        @Result(column="update_date", property="updateDate", jdbcType=JdbcType.DATE),
        @Result(column="total_price", property="totalPrice", jdbcType=JdbcType.DOUBLE),
        @Result(column="comment", property="comment", jdbcType=JdbcType.LONGVARCHAR)
    })
    List<BusinessInfoEntity> selectByExampleWithBLOBs(BusinessInfoEntityExample example);

    /**
     *
     * @mbg.generated
     */
    @SelectProvider(type=BusinessInfoEntitySqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="bus_id", property="busId", jdbcType=JdbcType.INTEGER, id=true),
        @Result(column="cid", property="cid", jdbcType=JdbcType.INTEGER),
        @Result(column="uid", property="uid", jdbcType=JdbcType.INTEGER),
        @Result(column="name", property="name", jdbcType=JdbcType.VARCHAR),
        @Result(column="marketing_mode", property="marketingMode", jdbcType=JdbcType.VARCHAR),
        @Result(column="value", property="value", jdbcType=JdbcType.INTEGER),
        @Result(column="total_amount", property="totalAmount", jdbcType=JdbcType.INTEGER),
        @Result(column="due_date", property="dueDate", jdbcType=JdbcType.DATE),
        @Result(column="practical_date", property="practicalDate", jdbcType=JdbcType.DATE),
        @Result(column="create_date", property="createDate", jdbcType=JdbcType.DATE),
        @Result(column="update_date", property="updateDate", jdbcType=JdbcType.DATE),
        @Result(column="total_price", property="totalPrice", jdbcType=JdbcType.DOUBLE)
    })
    List<BusinessInfoEntity> selectByExample(BusinessInfoEntityExample example);

    /**
     *
     * @mbg.generated
     */
    @Select({
        "select",
        "bus_id, cid, uid, name, marketing_mode, value, total_amount, due_date, practical_date, ",
        "create_date, update_date, total_price, comment",
        "from crm_business_info",
        "where bus_id = #{busId,jdbcType=INTEGER}"
    })
    @Results({
        @Result(column="bus_id", property="busId", jdbcType=JdbcType.INTEGER, id=true),
        @Result(column="cid", property="cid", jdbcType=JdbcType.INTEGER),
        @Result(column="uid", property="uid", jdbcType=JdbcType.INTEGER),
        @Result(column="name", property="name", jdbcType=JdbcType.VARCHAR),
        @Result(column="marketing_mode", property="marketingMode", jdbcType=JdbcType.VARCHAR),
        @Result(column="value", property="value", jdbcType=JdbcType.INTEGER),
        @Result(column="total_amount", property="totalAmount", jdbcType=JdbcType.INTEGER),
        @Result(column="due_date", property="dueDate", jdbcType=JdbcType.DATE),
        @Result(column="practical_date", property="practicalDate", jdbcType=JdbcType.DATE),
        @Result(column="create_date", property="createDate", jdbcType=JdbcType.DATE),
        @Result(column="update_date", property="updateDate", jdbcType=JdbcType.DATE),
        @Result(column="total_price", property="totalPrice", jdbcType=JdbcType.DOUBLE),
        @Result(column="comment", property="comment", jdbcType=JdbcType.LONGVARCHAR)
    })
    BusinessInfoEntity selectByPrimaryKey(Integer busId);

    /**
     *
     * @mbg.generated
     */
    @UpdateProvider(type=BusinessInfoEntitySqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("record") BusinessInfoEntity record, @Param("example") BusinessInfoEntityExample example);

    /**
     *
     * @mbg.generated
     */
    @UpdateProvider(type=BusinessInfoEntitySqlProvider.class, method="updateByExampleWithBLOBs")
    int updateByExampleWithBLOBs(@Param("record") BusinessInfoEntity record, @Param("example") BusinessInfoEntityExample example);

    /**
     *
     * @mbg.generated
     */
    @UpdateProvider(type=BusinessInfoEntitySqlProvider.class, method="updateByExample")
    int updateByExample(@Param("record") BusinessInfoEntity record, @Param("example") BusinessInfoEntityExample example);

    /**
     *
     * @mbg.generated
     */
    @UpdateProvider(type=BusinessInfoEntitySqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(BusinessInfoEntity record);

    /**
     *
     * @mbg.generated
     */
    @Update({
        "update crm_business_info",
        "set cid = #{cid,jdbcType=INTEGER},",
          "uid = #{uid,jdbcType=INTEGER},",
          "name = #{name,jdbcType=VARCHAR},",
          "marketing_mode = #{marketingMode,jdbcType=VARCHAR},",
          "value = #{value,jdbcType=INTEGER},",
          "total_amount = #{totalAmount,jdbcType=INTEGER},",
          "due_date = #{dueDate,jdbcType=DATE},",
          "practical_date = #{practicalDate,jdbcType=DATE},",
          "create_date = #{createDate,jdbcType=DATE},",
          "update_date = #{updateDate,jdbcType=DATE},",
          "total_price = #{totalPrice,jdbcType=DOUBLE},",
          "comment = #{comment,jdbcType=LONGVARCHAR}",
        "where bus_id = #{busId,jdbcType=INTEGER}"
    })
    int updateByPrimaryKeyWithBLOBs(BusinessInfoEntity record);

    /**
     *
     * @mbg.generated
     */
    @Update({
        "update crm_business_info",
        "set cid = #{cid,jdbcType=INTEGER},",
          "uid = #{uid,jdbcType=INTEGER},",
          "name = #{name,jdbcType=VARCHAR},",
          "marketing_mode = #{marketingMode,jdbcType=VARCHAR},",
          "value = #{value,jdbcType=INTEGER},",
          "total_amount = #{totalAmount,jdbcType=INTEGER},",
          "due_date = #{dueDate,jdbcType=DATE},",
          "practical_date = #{practicalDate,jdbcType=DATE},",
          "create_date = #{createDate,jdbcType=DATE},",
          "update_date = #{updateDate,jdbcType=DATE},",
          "total_price = #{totalPrice,jdbcType=DOUBLE}",
        "where bus_id = #{busId,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(BusinessInfoEntity record);
}